using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace Accountability4net
{
    /// <summary>
    /// Defines an account. Implementors must secure that <see cref="IAccount.Number" />
    /// uniquely identifies an account.
    /// </summary>
    public interface IAccount: INotifyPropertyChanged
    {
        /// <summary>
        /// The type of account
        /// </summary>
        AccountType Type { get; set; } 
        /// <summary>
        /// Unique identifier for the account
        /// </summary>
        int Number { get; set; }
        /// <summary>
        /// Debits the account with the specified amount.
        /// This method is called from <see cref="ITransaction.Commit()" /> for each
        /// <see cref="IAction" /> of type <see cref="ActionType.DEBIT" />
        /// </summary>
        /// <param name="amount">The amount to debit the account</param>
        /// <param name="transaction">The transaction the action is performed in</param>
        /// <returns>The balance of the account after the action</returns>
        Decimal Debit(Decimal amount, ITransaction transaction);
        /// <summary>
        /// Credits the account with the specified amount.
        /// This method is called from <see cref="ITransaction.Commit()" /> for each
        /// <see cref="IAction" /> of type <see cref="ActionType.CREDIT" />
        /// </summary>
        /// <param name="amount">The amount to credit the account</param>
        /// <param name="transaction">The transaction the action is performed in</param>
        /// <returns>The balance of the account after the action</returns>
        Decimal Credit(Decimal amount, ITransaction transaction);
        /// <summary>
        /// The current balance of the account
        /// </summary>
        Decimal Balance { get; }
        /// <summary>
        /// The name of the account
        /// </summary>
        string Name { get; set;}
        /// <summary>
        /// The description of the account
        /// </summary>
        string Description { get; set;}
    }
}
